package cn.java79.springcore.aop;

import org.aspectj.lang.ProceedingJoinPoint;

import java.util.Arrays;
import java.util.Date;

/**
 * @author oldliu
 * @since 1.0
 */
public class LogInterceptor {

    public Object around(ProceedingJoinPoint jp) throws Throwable {
        System.out.println("对象是："+jp.getTarget());
        System.out.println("方法名："+jp.getSignature().getName());
        System.out.println("开始于："+new Date());
        //阻止执行，抛出异常
        System.out.println("方法参数是："+ Arrays.toString(jp.getArgs()));
        Object proceed = jp.proceed();
        System.out.println("结束于："+new Date()+"返回了："+proceed);
        return  proceed;
    }
}
